<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绑定样式</title>
    <script src="/js/vue-2.7.9-dev.js"></script>
    <style>
        .red{
            background-color: red;
            width: 100px;
            height: 100px;
        }
        .redB{
            margin: 200px;
        }
    </style>
</head>
<body>
    <div id="app">
        <div :class="red"></div>
        <button @click="changeClass">改变样式</button>
    </div>

    <script>
        let vm = new Vue({
            data() { 
                console.log("==", this);
                return {
                    red:['red']
                }
            },
            methods: {
                changeClass(){
                    this.red = ['red', 'redB']
                }
            },
        })
        vm.$mount("#app")
        console.log("--",vm);
    </script>
</body>
</html>